<template>
  <!-- 审核管理 -->
  <div class="bsh">
    <div class="sh">
      <div class="top">
        <div v-for="(item,index) in moduleList" :class="[index==tableIndex? 'tai':'','shai']"
             @click="tableClick(index)">
          <div class="img">
            <img
              :src="index==tableIndex? require('../../assets/images/ShenHeGuanLi/'+item.seled):require('../../assets/images/ShenHeGuanLi/'+item.sel)"
              alt/>
          </div>
          <div :class="[index==tableIndex?'wenzi1':'wenzi']">
            <!--<div class="shu">0</div>-->
            <div class="wen">{{ item.title }}</div>
          </div>
        </div>
      </div>
      <el-table stripe class="table" :data="tableData" style="width: 100%" height="520">
        <el-table-column prop="createOnStr" label="申请时间" align="center"></el-table-column>
        <el-table-column prop="typeStr" label="审核类型" align="center" width="180"></el-table-column>
        <el-table-column prop="departName" label="申请部门" align="center"></el-table-column>
        <el-table-column prop="creater" label="申请人" align="center"></el-table-column>
        <el-table-column prop="stateStr" label="状态" align="center"></el-table-column>
        <el-table-column label="操作" align="center" width="200">
          <template slot-scope="scope">
            <el-button
              type="primary"
              size="mini"
              @click="xiangqing(scope.row.id,scope.row.type,0,scope.row.minTitle)"
              v-if="scope.row.paixu==1&&(tableIndex==0||tableIndex==1||tableIndex==2)"
            >审核
            </el-button>
            <el-button
              type="text"
              size="mini"
              @click="xiangqing(scope.row.id,scope.row.type,1,scope.row.minTitle)"
              v-if="(tableIndex==0||tableIndex==1||tableIndex==2)"
            >详情
            </el-button>
            <!--生产-->
            <el-button
              type="primary"
              size="mini"
              @click="xiangqingSC(scope.row,scope.row.type,isDetail=false)"
              v-if="tableIndex==3&&(scope.row.shengheStatus==1)"
            >审核
            </el-button>
            <el-button
              type="text"
              size="mini"
              @click="xiangqingSC(scope.row,scope.row.type,isDetail=true)"
              v-if="tableIndex==3"
            >详情
            </el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <!--=========采购订单===弹框==================-->
    <el-dialog :visible.sync="dialog_PurchaseOrder" :modal-append-to-body="false" width="1200px">
      <div class="herd_bud"></div>
      <div class="from_cg">采购详情</div>
      <br/>
      <p class="Purchase_Division"></p>
      <div class="Demo_xs">
        <el-form
          :model="PurchaseOrder_formInlineBy"
          :inline="true"
          class="demo-form-inline"
          label-width="100px"
        >
          <el-form-item label="供货商">
            <el-input v-model="PurchaseOrder_formInlineBy.supplierName" :disabled="true"></el-input>
          </el-form-item>
          <el-form-item label="采购单号">
            <el-input v-model="PurchaseOrder_formInlineBy.orderNumber" :disabled="true"></el-input>
          </el-form-item>
        </el-form>
        <el-table
          :data="PurchaseOrder_tableData_PRODUCT"
          height="400"
          :max-height="400">
          <el-table-column label="序号" align="center" type="index" width="70px">

          </el-table-column>
          <el-table-column label="产品图号" align="center">
            <template slot-scope="scope">
              <el-input disabled v-model="scope.row.productNumber"></el-input>
            </template>
          </el-table-column>
          <el-table-column label="产品名称" align="center">
            <template slot-scope="scope">
              <el-input disabled v-model="scope.row.productName"></el-input>
            </template>
          </el-table-column>
          <el-table-column label="采购数量" align="center">
            <template slot-scope="scope">
              <el-input disabled v-model="scope.row.number"></el-input>
            </template>
          </el-table-column>
          <el-table-column label="单价(元)" align="center">
            <template slot-scope="scope">
              <el-input disabled v-model="scope.row.price"></el-input>
            </template>
          </el-table-column>
          <el-table-column label="小计(元)" align="center">
            <template slot-scope="scope">
              <el-input disabled v-model="scope.row.xiaoji"></el-input>
            </template>
          </el-table-column>
          <el-table-column label="到货时间" align="center" >
            <template slot-scope="scope">
              <el-date-picker
                style="width:100%"
                v-model="scope.row.daohuoTime"
                type="date"
                placeholder="选择日期"
                value-format="yyyy-MM-dd"
                :disabled="true"
              >
              </el-date-picker>
            </template>
          </el-table-column>
          <el-table-column label="提前时间" align="center">
            <template slot-scope="scope">
              <el-input disabled v-model="scope.row.tiqianTixing"></el-input>
            </template>
          </el-table-column>
        </el-table>
        <br/>
        <p class="Purchase_Division"></p>
        <div class="from_towbs" style="display:flex;justify-content: center;align-items: center;margin-top: 10px">
          <el-button v-if="isDetail==false" @click="dialog_PurchaseOrder = false||pass(1)" type="primary"
                     size="small">通过
          </el-button>
          <el-button v-if="isDetail==false" @click="disAllowance()" type="info" size="small">驳回</el-button>
          <el-button v-if="isDetail==true" @click="dialog_PurchaseOrder = false" type="info" size="small">取消
          </el-button>
        </div>
      </div>
    </el-dialog>
    <!--=================采购退货===========================-->
    <el-dialog :visible.sync="dialog_PurchaseReturnGoods" :modal-append-to-body="false" width="1300px">
      <div class="herd_bud"></div>
      <div class="from_bt">退货详情</div>
      <div style="width: 100%;height: 60px;border-top: 1px solid rgb(220, 222, 226);padding-top: 10px">
        <span style="display: inline-block;font-size: 14px;color: #333333;width: 80px">供货商:</span>
        <el-input disabled style="width: 220px"
                  v-model="dialog_PurchaseReturnGoods_supplierDetail.supplierName"></el-input>
      </div>
      <div style="width: 100%">
        <span>产品：</span>
        <el-table
          :data="dialog_PurchaseReturnGoods_tableData_PRODUCTDETAIL"
          style="width: 100%;height: 300px"
          :max-height="300"
        >
          <el-table-column type="index" label="序号" align="center" width="80"></el-table-column>
          <el-table-column prop="productNumber" label="产品图号" width="180" align="center"></el-table-column>
          <el-table-column
            prop="productName"
            label="产品名称"
            align="center">
          </el-table-column>
          <el-table-column
            prop="price"
            label="单价(元)"
            align="center">
          </el-table-column>
          <el-table-column
            prop="danwei"
            label="单位"
            align="center">
          </el-table-column>
          <el-table-column
            prop="chengpinkuNumber"
            label="成品退货数"
            align="center">
          </el-table-column>
          <el-table-column
            prop="feipinkuNumber"
            label="废品退货数"
            align="center">
          </el-table-column>
          <el-table-column
            prop="moneySum"
            label="小计"
            align="center">
          </el-table-column>
          <el-table-column
            prop="number"
            label="退货总数"
            align="center">
          </el-table-column>
        </el-table>
      </div>
      <div class="from_tab_btn" style="display:flex;justify-content: center;align-items: center">
        <el-button v-if="isDetail==false" @click="pass_returnGood(1)" type="primary" size="small">确 认</el-button>
        <el-button v-if="isDetail==false" @click="disAllowance_returnGood()" type="primary" size="small">驳 回
        </el-button>
        <el-button v-if="isDetail==true" @click="dialog_PurchaseReturnGoods = false" type="info" size="small">取 消
        </el-button>
      </div>
    </el-dialog>
    <!--=================开票=========================================-->
    <el-dialog :visible.sync="dialog_PurchaseKaiPiao" :modal-append-to-body="false" width="1300px">
      <div class="herd_bud"></div>
      <div class="from_bt">开票详情</div>
      <!--供应商-->
      <div style="height: 70px">
        <el-form :inline="true" :model="PurchaseKaiPiao_fromDataSupplier" style="height: 100%">
          <el-form-item label="供应商名称">
            <el-input disabled v-model="PurchaseKaiPiao_fromDataSupplier.supplierName"></el-input>
          </el-form-item>
          <el-form-item label="联系人">
            <el-input disabled v-model="PurchaseKaiPiao_fromDataSupplier.lianxiren"></el-input>
          </el-form-item>
          <el-form-item label="联系方式">
            <el-input disabled v-model="PurchaseKaiPiao_fromDataSupplier.phone"></el-input>
          </el-form-item>
          <el-form-item label="总金额">
            <el-input disabled v-model="PurchaseKaiPiao_fromDataSupplier.moneySum"></el-input>
          </el-form-item>
        </el-form>
      </div>
      <!--本次审核的开票的信息-->
      <div
        style="font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;font-size: 14px;width: 100%;margin-top: 15px">
        开票审核 ：
      </div>
      <div class="purInfo002" style="margin-top: 15px">
        <el-table :data="PurchaseKaiPiao_tableDataKaiPiao"
                  width="100%"
                  height="300px"
                  :max-height="150"
                  :row-style="{height:'37px'}"
        >
          <el-table-column type="index" width="150" align="center" label="序号"></el-table-column>
          <el-table-column prop="piaoNumber" label="票号" align="center">
          </el-table-column>
          <el-table-column prop="status" label="状态" align="center">
            <template v-slot="scope">
              <div v-if="scope.row.status==1" >待审核</div>
              <div v-if="scope.row.status==2" style="color: red">驳回</div>
              <div v-if="scope.row.status==3">已完成</div>
            </template>
          </el-table-column>
          <el-table-column prop="kaipiaoTime" label="开票时间" align="center">
            <template slot-scope="scope">
              {{geshiTime(scope.row.kaipiaoTime)}}
            </template>
          </el-table-column>
          <el-table-column prop="money" label="发票金额" align="center">
          </el-table-column>
        </el-table>
      </div>
      <!--开票记录-->
      <div
        style="font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;font-size: 14px;width: 100%;margin-top: 15px">
        开票记录 ：
      </div>
      <div class="purInfo002" style="margin-top: 15px">
        <el-table :data="PurchaseKaiPiao_tableDataKaiPiaoLog"
                  width="100%"
                  height="300px"
                  :max-height="150"
                  :row-style="{height:'37px'}"
        >
          <el-table-column type="index" width="150" align="center" label="序号"></el-table-column>
          <el-table-column prop="piaoNumber" label="票号" align="center">
          </el-table-column>
          <el-table-column prop="status" label="状态" align="center">
            <template v-slot="scope">
              <div v-if="scope.row.status==1" >待审核</div>
              <div v-if="scope.row.status==2" style="color: red">驳回</div>
              <div v-if="scope.row.status==3">已完成</div>
            </template>
          </el-table-column>
          <el-table-column prop="kaipiaoTime" label="开票时间" align="center">
            <template slot-scope="scope">
              {{geshiTime(scope.row.kaipiaoTime)}}
            </template>
          </el-table-column>
          <el-table-column prop="money" label="发票金额" align="center">
          </el-table-column>
        </el-table>
      </div>
      <div class="from_tab_btn" style="display:flex;justify-content: center;align-items: center">
        <el-button v-if="isDetail==false" @click="pass_kaipiao(1)" type="primary" size="small">确 认</el-button>
        <el-button v-if="isDetail==false" @click="disAllowance_kaipiao()" type="primary" size="small">驳 回
        </el-button>
        <el-button v-if="isDetail==true" @click="dialog_PurchaseKaiPiao = false" type="info" size="small">取 消
        </el-button>
      </div>
    </el-dialog>
    <!--=================付款=========================================-->
    <el-dialog :visible.sync="dialog_PurchaseFuKuan" :modal-append-to-body="false" width="1300px">
      <div class="herd_bud"></div>
      <div class="from_bt">付款详情</div>
      <!--供应商-->
      <div style="height: 100px">
        <el-form :inline="true" :model="PurchaseFuKuan_fromDataSupplier" style="height: 100%">
          <el-form-item label="供应商名称">
            <el-input disabled v-model="PurchaseFuKuan_fromDataSupplier.supplierName"></el-input>
          </el-form-item>
          <el-form-item label="联系人">
            <el-input disabled v-model="PurchaseFuKuan_fromDataSupplier.lianxiren"></el-input>
          </el-form-item>
          <el-form-item label="联系方式">
            <el-input disabled v-model="PurchaseFuKuan_fromDataSupplier.phone"></el-input>
          </el-form-item>
          <el-form-item label="总金额">
            <el-input disabled v-model="PurchaseFuKuan_fromDataSupplier.moneySum"></el-input>
          </el-form-item>
          <br>
          <el-form-item label="本次付款金额">
            <el-input disabled v-model="PurchaseFuKuan_fromDataSupplier.jieSuanMoneyNow"></el-input>
          </el-form-item>
        </el-form>
      </div>
      <!--付款记录-->
      <div
        style="font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;font-size: 14px;width: 100%;margin-top: 15px">
        开票记录 ：
      </div>
      <div class="purInfo002" style="margin-top: 15px">
        <el-table :data="PurchaseFuKuan_tableDataFuKuanLog"
                  width="100%"
                  height="300px"
                  :max-height="150"
                  :row-style="{height:'37px'}"
        >
          <el-table-column type="index" align="center" label="序号" width="70px"></el-table-column>
          <el-table-column prop="fukuanMoney" label="付款金额" align="center">
          </el-table-column>
          <el-table-column prop="status" label="状态" align="center">
            <template v-slot="scope">
              <div v-if="scope.row.status==1" >待审核</div>
              <div v-if="scope.row.status==2" style="color: red">驳回</div>
              <div v-if="scope.row.status==3">已完成</div>
            </template>
          </el-table-column>
          <el-table-column prop="createonTime" label="付款时间" align="center">
            <template v-slot="scope">
              <div>{{geshiTime(scope.row.createonTime)}}</div>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div class="from_tab_btn" style="display:flex;justify-content: center;align-items: center;margin-top: 10px">
        <el-button v-if="isDetail==false" @click="pass_fukuan(1)" type="primary" size="small">确 认</el-button>
        <el-button v-if="isDetail==false" @click="disAllowance_fukuan()" type="primary" size="small">驳 回
        </el-button>
        <el-button v-if="isDetail==true" @click="dialog_PurchaseFuKuan = false" type="info" size="small">取 消
        </el-button>
      </div>
    </el-dialog>
    <!--=========================驳回======================================-->
    <!--采购订单-->
    <el-dialog
      title="驳回理由"
      :visible.sync="dialogVisible_refuse"
      width="30%"
      append-to-body>
      <el-input v-model="bohui"></el-input>
      <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible_refuse = false">取 消</el-button>
    <el-button type="primary" @click="pass(2)">确 定</el-button>
          </span>
    </el-dialog>
    <!--采购退货-->
    <el-dialog
      title="驳回理由"
      :visible.sync="dialogVisible_refuse_returnGood"
      width="30%"
      append-to-body>
      <el-input v-model="bohui"></el-input>
      <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible_refuse_returnGood = false">取 消</el-button>
    <el-button type="primary" @click="pass_returnGood(2)">确 定</el-button>
  </span>
    </el-dialog>
    <!--开票-->
    <el-dialog
      title="驳回理由"
      :visible.sync="dialogVisible_refuse_KaiPiao"
      width="30%"
      append-to-body>
      <el-input v-model="bohui"></el-input>
      <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible_refuse_KaiPiao = false">取 消</el-button>
    <el-button type="primary" @click="pass_kaipiao(2)">确 定</el-button>
  </span>
    </el-dialog>
    <!--付款-->
    <el-dialog
      title="驳回理由"
      :visible.sync="dialogVisible_refuse_FuKuan"
      width="30%"
      append-to-body>
      <el-input v-model="bohui"></el-input>
      <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible_refuse_FuKuan = false">取 消</el-button>
    <el-button type="primary" @click="pass_fukuan(2)">确 定</el-button>
  </span>
    </el-dialog>
    <!--付款/开票-->
    <!--开票、付款 -->
    <el-dialog
      title="详情"
      :visible.sync="dialogVisible_kaipiao_fukuang"
      width="76%"
      :modal-append-to-body="false">
      <template>
        <ul v-show="global_status==3||global_status==4" class="el-inputbox">
          <li>
            <span>站点名称</span>
            <el-input style="width: 68%;" disabled v-model="custom_info.siteName"></el-input>
          </li>
          <li>
            <span>联系人</span>
            <el-input style="width: 68%;" disabled v-model="custom_info.contactPerson"></el-input>
          </li>
          <li>
            <span>联系方式</span>
            <el-input style="width: 68%;" disabled v-model="custom_info.phone"></el-input>
          </li>
          <li>
            <span>总金额</span>
            <el-input style="width: 68%;" disabled v-model="custom_info.totalMoney"></el-input>
          </li>
        </ul>
        <ul v-show="global_status==3||global_status==4" class="el-inputbox">
          <li>
            <span>已付款金额</span>
            <el-input style="width: 68%;" disabled v-model="custom_info.paymentMoney"></el-input>
          </li>
          <li>
            <span>剩余付款金额</span>
            <el-input style="width: 68%;" disabled v-model="custom_info.lastPaymentMoney"></el-input>
          </li>
          <li>
            <span>申请中金额</span>
            <el-input style="width: 68%;" disabled v-model="custom_info.applyPaymentMoney"></el-input>
          </li>
          <li>
            <span>本次付款金额</span>
            <el-input disabled style="width: 68%;" v-model="paymentMoneyNow"></el-input>
          </li>
        </ul>
      </template>
      <template>
        <el-table
          :data="tableData_repairLog"
          style="width: 100%">
          <el-table-column
            type="index"
            label="序号"
            align="center">
          </el-table-column>
          <el-table-column
            prop="applyTime" align="center"
            label="维修日期">
            <template v-slot="scope">
              <span>{{geshiTime(scope.row.applyTime)}}</span>
            </template>
          </el-table-column>
          <el-table-column
            prop="productName" align="center"
            label="零件名称">
          </el-table-column>
          <el-table-column
            prop="productTuhao" align="center"
            label="零件图号">
          </el-table-column>
          <el-table-column
            prop="number" align="center"
            label="数量">
          </el-table-column>
          <el-table-column
            prop="returnNumber" align="center"
            label="返件总量">
          </el-table-column>
          <el-table-column
            prop="danjia" align="center"
            label="单价（元）">
          </el-table-column>
          <el-table-column
            prop="chalvfei" align="center"
            label="管理费（元）">
          </el-table-column>
          <el-table-column
            prop="money" align="center"
            label="金额（元）">
          </el-table-column>
          <el-table-column
            prop="chalvfei" align="center"
            label="差旅费（元）">
          </el-table-column>
          <el-table-column
            prop="qitafeiyong" align="center"
            label="其他费用">
          </el-table-column>
        </el-table>
      </template>
      <template>
        <el-table
          :data="tableData_detail_kaipiaoLog"
          style="width: 100%">
          <el-table-column
            type="index"
            label="序号"
            align="center">
          </el-table-column>
          <el-table-column
            label="开票时间"
            prop="kaipiaoTime"
            align="center">
            <template v-slot="scope">
              <div>{{geshiTime(scope.row.kaipiaoTime)}}</div>
            </template>
          </el-table-column>
          <el-table-column
            label="开票号"
            prop="piaoNumber"
            align="center">
          </el-table-column>
          <el-table-column
            prop="money"
            label="开票额"
            align="center">
          </el-table-column>
          <el-table-column
            label="状态"
            align="center">
            <template v-slot="scope">
              <span v-if="scope.row.status==1" style="color: red">待审核</span>
              <span v-if="scope.row.status==2">已驳回</span>
              <span v-if="scope.row.status==3">已完成</span>
            </template>
          </el-table-column>
        </el-table>
        <div class="piaomian">
          <span>票面总额</span>
          <el-input disabled style="width: 10%;" v-model="faFaceValue"></el-input>
        </div>
      </template>
      <template>
        <p v-show="global_status==3||global_status==4" class="huizo">付款记录 :</p>
        <template>
          <el-table
            v-show="global_status==3||global_status==4"
            :data="tableData_paymentLog"
            style="width: 100%">
            <el-table-column
              type="index"
              align="center"
              label="序号">
            </el-table-column>
            <el-table-column
              prop="money" align="center"
              label="付款金额">
            </el-table-column>
            <el-table-column
              align="center"
              label="付款时间">
              <template v-slot="scope">{{geshiTime(scope.row.createonTime)}}</template>
            </el-table-column>
            <el-table-column
              label="状态" align="center">
              <template v-slot="scope">
                <span v-if="scope.row.status==1">待审核</span>
                <span v-if="scope.row.status==2">驳回</span>
                <span v-if="scope.row.status==3">已完成</span>
              </template>
            </el-table-column>
          </el-table>
        </template>
      </template>
      <span slot="footer" class="dialog-footer">
        <el-button v-show="isDetail==false" @click="dialogVisible_kaipiao_fukuang = false;confirm_kaipiao_fukuan(3)"
                   type="primary">确 定</el-button>
        <el-button v-show="isDetail==false" @click="dialogVisible_kaipiao_fukuang = false;show_BoHui">驳 回</el-button>
        <el-button v-show="isDetail==true" @click="dialogVisible_kaipiao_fukuang = false">取 消</el-button>
  </span>
    </el-dialog>
    <!-- 开票 付款驳回   -->
    <el-dialog
      title="驳回"
      :visible.sync="dialogVisible_turnDown"
      width="30%"
      :modal-append-to-body="false">
      <span>驳回理由 : </span>
      <el-input style="width: 80%" v-model="bohui" placeholder="请输入驳回理由"></el-input>
      <span slot="footer" class="dialog-footer">
    <el-button type="primary" @click="dialogVisible_turnDown = false ,confirm_kaipiao_fukuan(4)">确 定</el-button>
    <el-button @click="dialogVisible_turnDown = false">取 消</el-button>
  </span>
    </el-dialog>
    <!--============================分页===================================================-->
    <div class="pgnt">
      <el-pagination
        background
        layout="prev, pager, next"
        :current-page="current"
        :page-size="pagesize"
        @current-change="handleCurrentChange"
        :total="total"
      ></el-pagination>
    </div>
  </div>
</template>

<script>
import axios from 'axios'

export default {
  inject:['reload'],
  data() {
    return {
      custom_info:{},
      global_status:null,
      dialogVisible_kaipiao_fukuang:false,
      dialogVisible_turnDown:false,
      tableData_paymentLog:[],
      tableData_detail_kaipiaoLog:[],
      tableData_repairLog:[],
      paymentMoneyNow:0,
      faFaceValue:0,
      //模块的集合
      moduleList: [
        {title: "人事审核", type: 1, sel: 'u16129.png', seled: "2.png"},
        {title: "行政审核", type: 2, sel: "u16145.png", seled: "4.png"},
        {title: "财务审核", type: 3, sel: 'u16137.png', seled: "1.png"},
        {title: "生产审核", type: 4, sel: 'sc.png', seled: "sc2.png"},
      ],
      tableIndex: 0,
      formInline: {},
      tableData: [],
      renshi: 0,
      caiwu: 0,
      xingzhen: 0,
      xiangmu: 0,
      total: 0,
      current: 1,
      pagesize: 10,
      key: 0,
      numList: {},
      /*=================弹框===========================*/
      dialog_PurchaseOrder: false,//采购订单
      dialogVisible_refuse: false,//驳回
      dialog_PurchaseReturnGoods: false,//采购退货
      dialog_PurchaseKaiPiao: false,//开票
      dialog_PurchaseFuKuan: false,//付款
      dialogVisible_refuse_returnGood: false,//驳回
      dialogVisible_refuse_FuKuan: false,//驳回
      dialogVisible_refuse_KaiPiao: false,//驳回
      /******弹框的所有的数据*****/
      isDetail: false,
      bohui: "",
      PurchaseOrder_formInlineBy: {},
      PurchaseOrder_tableData_PRODUCT: [],
      dialog_PurchaseReturnGoods_supplierDetail: {},////采购退货管理供应商详情
      dialog_PurchaseReturnGoods_tableData_PRODUCTDETAIL: [],//采购退货管理的产品
      PurchaseKaiPiao_fromDataSupplier: {},//开票供应商的基本信息
      PurchaseFuKuan_fromDataSupplier: {},//付款供应商的基本信息
      PurchaseKaiPiao_tableDataKaiPiaoLog: [],
      PurchaseKaiPiao_tableDataKaiPiao: [],
      PurchaseFuKuan_tableDataFuKuanLog: [],
    };
  },
  created() {
    this.creater = JSON.parse(localStorage.getItem("message")).Id;
    console.log(localStorage.getItem("ceoTab"))
    this.tableIndex=localStorage.getItem("ceoTab")==null?0:JSON.parse(localStorage.getItem("ceoTab"));
    this.getData(0);
    this.gettotal()
  },
  methods: {
    //格式化时间
    geshiTime(date) {
      return date==null?"":date.substring(0, 10);
    },
    show_BoHui() {
      this.dialogVisible_kaipiao_fukuang = false
      this.dialogVisible_turnDown = true
    },
    confirm_kaipiao_fukuan(status) {
      let message = JSON.parse(localStorage.getItem("message"));
      let param = {
        "bohui": this.bohui,
        "checkFolwId": this.global_checkFlowId,
        "shengheMessageId": this.global_id,
        "status": status,
        "userId": message.Id,
        "userName": message.Name
      }
      console.log(param)
      axios.post("/JX_java/procurement/caigoushenghe/updatestatus", param).then(res => {
        if (res.data.data == "操作成功") {
          this.$message.success(res.data.data);
          this.reload()
          this.dialogVisible_kaipiao_fukuang = false
        } else {
          this.$message.error(res.data.data);
        }
      })
    },
    tableClick(e) {
      this.tableIndex = e
      localStorage.setItem("ceoTab", e);
      this.tableData = []
      this.getData(0);

      console.log(this.tableIndex, 222222222222222222)
    },
    /********弹框通过*********************/
    //付款
    pass_fukuan(type) {
      let statue = type == 1 ? 3 : 2
      const message = JSON.parse(localStorage.getItem("message"))
      if (type == 2) {
        if (this.bohui == "") {
          this.$message.error("驳回理由不能为空！");
          return;
        }
      }
      const param = {
        "bohui": this.bohui,
        "checkFolwId": this.PurchaseFuKuan_fromDataSupplier.checkFolwId,
        "shengheMessageId": this.PurchaseFuKuan_fromDataSupplier.id,
        "status": statue,
        "userId": message.Id,
        "userName": message.Name
      }
      axios.post("/JX_java/procurement/caigoushenghe/updatestatus", param).then(res => {
        console.log(res.data.data);
        if (res.data.data == "操作成功") {
          this.$message.success(res.data.data);
          this.dialog_PurchaseFuKuan = false;
          this.reload()
        } else {
          this.$message.error(res.data.data);
        }
      })

    },
    disAllowance_fukuan() {
      this.bohui = ""
      this.dialog_PurchaseFuKuan = false;
      this.dialogVisible_refuse_FuKuan = true;
    },
    //开票
    pass_kaipiao(type) {
      let statue = type == 1 ? 3 : 2
      const message = JSON.parse(localStorage.getItem("message"))
      if (type == 2) {
        if (this.bohui == "") {
          this.$message.error("驳回理由不能为空！");
          return;
        }
      }
      const param = {
        "bohui": this.bohui,
        "checkFolwId": this.PurchaseKaiPiao_fromDataSupplier.checkFolwId,
        "shengheMessageId": this.PurchaseKaiPiao_fromDataSupplier.id,
        "status": statue,
        "userId": message.Id,
        "userName": message.Name
      }
      axios.post("/JX_java/procurement/caigoushenghe/updatestatus", param).then(res => {
        console.log(res.data.data);
        if (res.data.data == "操作成功") {
          this.$message.success(res.data.data);
          this.dialog_PurchaseKaiPiao = false;
          this.reload()
        } else {
          this.$message.error(res.data.data);
        }
      })
    },
    disAllowance_kaipiao() {
      this.bohui = ""
      this.dialog_PurchaseKaiPiao = false;
      this.dialogVisible_refuse_KaiPiao = true;
    },
    //退货
    pass_returnGood(type) {
      let statue = type == 1 ? 3 : 2
      const message = JSON.parse(localStorage.getItem("message"))
      if (type == 2) {
        if (this.bohui == "") {
          this.$message.error("驳回理由不能为空！");
          return;
        }
      }
      const param = {
        "bohui": this.bohui,
        "checkFolwId": this.dialog_PurchaseReturnGoods_supplierDetail.checkFlowId,
        "shengheMessageId": this.dialog_PurchaseReturnGoods_supplierDetail.id,
        "status": statue,
        "userId": message.Id,
        "userName": message.Name
      }
      console.log(param)

      axios.post("/JX_java/procurement/caigoushenghe/updatestatus", param).then(res => {
        console.log(res.data.data)
        if (res.data.data == "操作成功") {
          this.$message.success(res.data.data);
          this.bohui = "";
          this.dialog_PurchaseOrder = false;
          this.reload()
        } else {
          this.$message.error(res.data.data);
        }
      })
    },
    disAllowance_returnGood() {
      this.bohui = ""
      this.dialog_PurchaseReturnGoods = false;
      this.dialogVisible_refuse_returnGood = true;
    },


    //采购订单
    pass(type) {
      let statue = type == 1 ? 3 : 2
      const message = JSON.parse(localStorage.getItem("message"))
      if (type == 2) {
        if (this.bohui == "") {
          this.$message.error("驳回理由不能为空！");
          return;
        }
      }
      const param = {
        "bohui": this.bohui,
        "checkFolwId": this.PurchaseOrder_formInlineBy.checkFlowId,
        "shengheMessageId": this.PurchaseOrder_formInlineBy.id,
        "status": statue,
        "userId": message.Id,
        "userName": message.Name
      };
      console.log(param, this.PurchaseOrder_formInlineBy)
      axios.post("/JX_java/procurement/caigoushenghe/updatestatus", param).then(res => {
        console.log(res.data.data)
        if (res.data.data == "操作成功") {
          this.$message.success(res.data.data);
          this.bohui = "";
          this.dialog_PurchaseOrder = false;
          this.reload()
          // window.history.go(-1);
        } else {
          this.$message.error(res.data.data);
        }
      })
    },
    disAllowance() {
      this.bohui = ""
      this.dialog_PurchaseOrder = false;
      this.dialogVisible_refuse = true;
    },
    // 首页列表数据
    getData(page) {
      if (this.tableIndex == 3) {
        let param = {
          "beginTime": "",
          "endTime": "",
          "key": "",
          "pageNum": 0,
          "pageSize": 0,
          "type": 0
        };
        console.log("去找java");
        let message = JSON.parse(localStorage.getItem("message"));
        axios.post("/JX_java/common/getShengHeList?userId=" + message.Id, param).then(res => {
          console.log(res, 3333333333333333333333333333333)
          res.data.data.content.forEach(e => {
            /*createOnStr  typeStr  departName  creater  stateStr*/
            let a = {
              id: 0,
              type: 0,
              status: 0,
              createOnStr: "",
              typeStr: "",
              departName: "",
              creater: "",
              stateStr: "",
              shengheStatus: 0,
              checkFolwId: 0
            }
            a.id = e.id
            a.checkFolwId = e.checkFolwId
            a.createOnStr = e.applyTime
            a.shengheStatus = e.shengheStatus
            a.type = e.type;
            a.status = e.status;
            a.typeStr = e.type == 10 ? "采购合同" : (e.type == 11 ? "采购订单" : (e.type == 12 ? "采购退货" : e.type == 14 ? "销售合同" : e.type == 15 ? "销售订单" : e.type == 16 ? "采购开票" : e.type == 17 ? "采购付款" : e.type == 20 ? "站点 - 维护 - 工时申请" : e.type == 21 ? "站点 - 申请 - 产品申请" :  e.type == 24 ? "站点开票":e.type == 25 ? "站点付款":""))
            a.departName = e.siteName == null ? "--" : e.siteName
            a.creater = e.userName
            a.stateStr = e.shengheStatus == 1 ? "待审核" : (e.shengheStatus == 2 ? "已驳回" : (e.shengheStatus == 3 ? "审核通过" : ""))
            this.tableData.push(a)
          });
        });
        return;
      } else {
        let obj = {
          pn: page,
          PerPageSize: this.pagesize,
          key: this.key,
          creater: this.creater,
          typeIndex: this.tableIndex
        };
        var objs = JSON.stringify(obj);
        let the = {index: 1, jsondata: objs}
        console.log(objs);
        axios.post("/apis/CEOManage.asmx/GetData", the).then(({data}) => {
          console.log(data, 111111111111111)
          var list = JSON.parse(data.d);
          console.log(list)
          this.total = list.count;
          this.tableData = list.data;
          this.numList = list.numList;
        });
      }

    },
    // 首页统计数据
    gettotal() {
      var obj = {creater: this.creater};
      var objs = JSON.stringify(obj);
      let the = {index: 18, jsondata: objs}
      axios.post("/apis/MyCenter.asmx/GetData", the).then(({data}) => {
        var list = JSON.parse(data.d);
        this.alldata = list;
      });
    },
    dateFormat(format, time) {
      var t = new Date(time)
      var tf = function (i) {
        return (i < 10 ? '0' : '') + i
      }
      return format.replace(/yyyy|MM|dd|HH|mm|ss/g, function (a) {
        switch (a) {
          case 'yyyy':
            return tf(t.getFullYear())
          // break
          case 'MM':
            return tf(t.getMonth() + 1)
          // break
          case 'mm':
            return tf(t.getMinutes())
          // break
          case 'dd':
            return tf(t.getDate())
          // break
          case 'HH':
            return tf(t.getHours())
          // break
          case 'ss':
            return tf(t.getSeconds())
          // break
        }
      })
    },
    // 人事筛选
    rehshisx() {
      this.getData(0, '人事审核')
      this.key = '人事审核'
    },
    // 财务审核
    caiwusx() {
      this.getData(0, '总裁审核')
      this.key = '总裁审核'
    },
    // 行政筛选
    xingzhengsx() {
      this.getData(0, '行政审核')
      this.key = '行政审核'
    },
    // 项目审核
    xiangmusx() {
      this.getData(0, '项目审核')
      this.key = '项目审核'
    },
    //生产审核
    shengchang() {

    },
    xiangqingSC(e, type, statue) {
      if (type == 10) {//采购合同
        this.$router.push({
          path: "/ExaminePurchaseContract", query: {
            id: e.id,
            type: type,
            statue: statue,
            checkFolwId: e.checkFolwId
          }
        })
      } else if (type == 11) {//采购订单
        this.dialog_PurchaseOrder = true
        axios.get("/JX_java/procurement/caigoushenghe/getshengHeDetails?shengheMessageId=" + e.id + "&&checkFlowId=" + e.checkFolwId).then(res => {
          console.log(res.data.data, res.data.data.checkFlowId)
          this.isDetail = statue;
          this.PurchaseOrder_formInlineBy.supplierName = res.data.data.pojo.supplierName
          this.PurchaseOrder_formInlineBy.orderNumber = res.data.data.pojo.orderNumber
          this.PurchaseOrder_formInlineBy.checkFlowId = res.data.data.checkFlowId
          this.PurchaseOrder_formInlineBy.id = e.id
          this.PurchaseOrder_tableData_PRODUCT = res.data.data.pojo.products
          for(let i = 0 ; i<this.tableData_PRODUCT.length;i++){
            this.PurchaseOrder_tableData_PRODUCT[i].xiaoji = this.PurchaseOrder_tableData_PRODUCT[i].xiaoji.toFixed(2);
          }
          console.log(this.PurchaseOrder_formInlineBy)
        })

      } else if (type == 12) {//采购退货
        axios.get("/JX_java/procurement/caigoushenghe/getshengHeDetails?shengheMessageId=" + e.id + "&&checkFlowId=" + e.checkFolwId).then(res => {
          console.log(res.data.data)
          this.dialog_PurchaseReturnGoods_supplierDetail.checkFlowId = res.data.data.checkFlowId
          this.dialog_PurchaseReturnGoods_supplierDetail.id = e.id
          this.dialog_PurchaseReturnGoods_supplierDetail.supplierName = res.data.data.pojo.supplierName
          this.dialog_PurchaseReturnGoods_tableData_PRODUCTDETAIL = res.data.data.pojo.warehouseLogs;
          this.dialog_PurchaseReturnGoods = true
        })
        console.log(id, type, statue, checkFolwId)

      }
      //许明龙 书
      else if (type == 14) {//销售合同(给审核页面没有)
        this.$router.push({
          path: "/SaleContractsSH", query: {
            id: e.id,
            type: type,
            statue: statue,
            checkFlowId: e.checkFolwId,
          },
        })
      } else if (type == 15) {//销售订单(给审核页面没有)
        this.$router.push({
          path: "/OrderManagementSH", query: {
            id: e.id,
            type: type,
            statue: statue,
            checkFolwId: e.checkFolwId
          }
        })
      } else if (type == 16) {//开票
        console.log(e)
        this.dialog_PurchaseKaiPiao = true
        axios.get("/JX_java/procurement/caigoushenghe/getshengHeDetails?shengheMessageId=" + e.id + "&&checkFlowId=" + e.checkFolwId).then(res => {
          console.log(res.data.data.pojo.id,111111111111111111)
          this.PurchaseKaiPiao_fromDataSupplier.id = res.data.data.pojo.id
          this.PurchaseKaiPiao_fromDataSupplier.checkFolwId = e.checkFolwId
          this.PurchaseKaiPiao_fromDataSupplier.supplierName = res.data.data.pojo.supplierName
          this.PurchaseKaiPiao_fromDataSupplier.lianxiren = res.data.data.pojo.lianxiren
          this.PurchaseKaiPiao_fromDataSupplier.phone = res.data.data.pojo.phone
          this.PurchaseKaiPiao_fromDataSupplier.moneySum = res.data.data.pojo.moneySum
          const kaipiaos = res.data.data.pojo.kaipiaos
          kaipiaos.forEach(e => {
            if (e.status == 1) {//本次审核的开票
              this.PurchaseKaiPiao_tableDataKaiPiao.push(e)
            } else {//开票历史记录
              this.PurchaseKaiPiao_tableDataKaiPiaoLog.push(e)
            }
          })
          console.log(res.data.data)

        })

      } else if (type == 17) {//付款
        // console.log(e)
        axios.get("/JX_java/procurement/caigoushenghe/getshengHeDetails?shengheMessageId=" + e.id + "&&checkFlowId=" + e.checkFolwId).then(res => {
          this.PurchaseFuKuan_fromDataSupplier.checkFolwId = e.checkFolwId
          this.PurchaseFuKuan_fromDataSupplier.id = e.shengheMessageId
          this.PurchaseFuKuan_fromDataSupplier.supplierName = res.data.data.pojo.supplierName
          this.PurchaseFuKuan_fromDataSupplier.lianxiren = res.data.data.pojo.lianxiren
          this.PurchaseFuKuan_fromDataSupplier.phone = res.data.data.pojo.phone
          this.PurchaseFuKuan_fromDataSupplier.moneySum = res.data.data.pojo.moneySum
          this.PurchaseFuKuan_fromDataSupplier.jieSuanMoneyNow = res.data.data.pojo.jieSuanMoneyNow
          this.PurchaseFuKuan_tableDataFuKuanLog = res.data.data.pojo.fukuans
          this.dialog_PurchaseFuKuan = true
        })
        console.log(e)
      } else if (type == 20) { // 站点 - 维护 - 工时申请
        this.$router.push({
          path: "/ExaminManageGSSH", query: {
            id: e.id,
            type: type,
            statue: statue,
            checkFolwId: e.checkFolwId
          }
        })
      } else if (type == 21) { //站点 - 申请 - 产品申请
        this.$router.push({
          path: "/ExaminManageCPSH", query: {
            id: e.id,
            type: type,
            statue: statue,
            checkFolwId: e.checkFolwId
          }
        })
      } else if (type == 24) {
        console.log(e, type, statue)
        this.isDetail = statue
        this.global_status = 2
        axios.get("/JX_java/procurement/caigoushenghe/getshengHeDetails?shengheMessageId=" + e.id + "&&checkFlowId=" + e.checkFolwId).then(res => {
          console.log(res.data.data)
          this.global_checkFlowId = e.checkFolwId
          let {partAndManpowers, invoiceTbs, kaipiaoMoney, status} = res.data.data.pojo
          this.global_id = e.id
          this.faFaceValue = kaipiaoMoney
          this.tableData_repairLog = partAndManpowers
          this.tableData_detail_kaipiaoLog = invoiceTbs
          this.dialogVisible_kaipiao_fukuang = true
        })

      } else if (type == 25) {
        console.log(e, type, statue)
        this.global_status = 3
        this.dialogVisible_kaipiao_fukuang = true
        axios.get("/JX_java/procurement/caigoushenghe/getshengHeDetails?shengheMessageId=" + e.id + "&&checkFlowId=" + e.checkFolwId).then(res => {
          this.global_checkFlowId = e.checkFolwId
          console.log(res.data.data.pojo)
          this.isDetail = statue
          let {
            paymentMoneyNow,
            siteInvoices,
            partAndManpowers,
            siteFukuans,
            totalMoney,
            paymentMoney,
            applyPaymentMoney,
            lastPaymentMoney,
            siteName,
            contactPerson,
            phone
          } = res.data.data.pojo;
          this.global_id = e.id
          this.custom_info.totalMoney = totalMoney
          this.custom_info.paymentMoney = paymentMoney
          this.custom_info.applyPaymentMoney = applyPaymentMoney
          this.custom_info.lastPaymentMoney = lastPaymentMoney
          this.custom_info.siteName = siteName
          this.custom_info.contactPerson = contactPerson
          this.custom_info.phone = phone
          this.tableData_repairLog = partAndManpowers
          this.tableData_detail_kaipiaoLog = siteInvoices
          this.tableData_paymentLog = siteFukuans
          this.faFaceValue = totalMoney
          this.paymentMoneyNow = paymentMoneyNow
          this.dialogVisible_kaipiao_fukuang = true
        })
      }

      /* axios.get("/JX_java/procurement/caigoushenghe/getshengHeDetails?shengheMessageId=" + e.shengheMessageId + "&&checkFlowId=" + e.checkFolwId).then(res => {
         console.log(res.data.data)
       })*/
    },
    xiangqing(e, type, shows, minTitle) {
      //1==出勤2==申请3==报销4==行政采购
      //==========================================
      if (type == 3) {
        this.$router.push({
          path: './AuditCaiwu',
          query: {e: e, shows: shows, type: minTitle}
        })
      } else if (type == 1) {
        this.$router.push({
          path: './AuditManagementDetail',
          query: {e: e, shows: shows, type: minTitle}
        })
      } else if (type == 2) {
        this.$router.push({
          path: './AuditXingzheng',
          query: {e: e, shows: shows, type: minTitle}
        })
      } else if (type == 4) {
        this.$router.push({
          path: './AuditXingzhengPurchase',
          query: {e: e, shows: shows, type: minTitle}
        })
      }
    },
    // 分页
    handleCurrentChange(e) {
      this.getData(e - 1, this.key)
    }
  }
}
</script>

<style lang="scss" scoped>
.el-inputbox {

  width: 100%;
  display: flex;
  flex-wrap: wrap;
  color: #909399;
  margin-top: 20px;
  margin-bottom: 10px;

  li {

    width: 33%;
    font-size: 14px;
    margin-bottom: 10px;
    text-align: center;


    span {
      display: inline-block;
      width: 25%;
    }
  }
}
.tai {
  background: rgb(81, 103, 210);
}

.bsh {
  padding-left: 10px;
  padding-right: 10px;
}

.sh {
  background-color: #fff;
  border-radius: 10px;
}

.top {
  height: 120px;
  padding-left: 10px;
  padding-top: 20px;
  // margin-bottom: 20px;
  border-bottom: 1px solid #f5f5f5;
}

.shai {
  width: 190px;
  height: 90px;
  border-radius: 5px;
  border: 1px solid rgba(228, 228, 228, 1);
  float: left;
  margin-right: 20px;
  overflow: hidden;
  cursor: pointer;
}

.img {
  width: 50px;
  height: 50px;
  float: left;
  margin-left: 15px;
  margin-top: 15px;
  margin-right: 25px;
}

.img img {
  width: 50px;
  height: 50px;
}

.img2 {
  width: 45px;
  height: 45px;
  margin-top: 20px;
  margin-left: 20px;
  margin-right: 30px;
}

.img2 img {
  width: 45px;
  height: 45px;
}

.wenzi {
  float: left;
  margin-top: 15px;
  font-size: 28px;
  color: #0962a7;
  text-align: center;
}

.wenzi1 {
  float: left;
  margin-top: 15px;
  font-size: 28px;
  color: white;
  text-align: center;
}

.shu {
  margin-bottom: 5px;
  font-weight: 700;
}

.wen {
  text-align: center;
  line-height: 55px;
  font-size: 14px;
}

.shaixuan {
  height: 60px;
  margin-bottom: 20px;
  padding-left: 20px;
  color: #505050;
  border-bottom: 2px solid #f5f5f5;
}

.table {
  margin-bottom: 20px;
}

.pgnt {
  text-align: center;
}
</style>
